﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace zuoye
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<Class>
            {
                new Class{Id=1,Name="张三",judge=false,Chinese=123,Mat=90,English=100,Totalscore=313 },
                new Class{Id=2,Name="李四",judge=true,Chinese=123,Mat=100,English=100,Totalscore=323 },
                new Class{Id=3,Name="王五",judge=true,Chinese=123,Mat=90,English=120,Totalscore=333 },
                new Class{Id=4,Name="赵六",judge=true,Chinese=125,Mat=90,English=112,Totalscore=327 },
            };
            Console.WriteLine("输出所有人的信息");
            foreach(var item in list)
            {
                Console.WriteLine($"编号：{item.Id},名字：{item.Name},是否文科：{item.judge}," +
                    $"语文问：{item.Chinese},数学：{item.Mat},英语：{item.English},总分：{item.Totalscore}");
            }
            Console.WriteLine();
            Console.WriteLine("输出所有文科生的信息");
            var score = list.Where(i => i.judge == true);
            foreach (var item in score)
            {
                Console.WriteLine($"编号：{item.Id},名字：{item.Name},是否文科：{item.judge}," +
                    $"语文问：{item.Chinese},数学：{item.Mat},英语：{item.English},总分：{item.Totalscore}");
            }
            Console.WriteLine();
            var avg = list.Where(i => i.judge == true).Average(j=>j.Totalscore);
            Console.WriteLine("文科平均成绩：",avg);
        }
    }
}
